<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <span>当前用户<a th:text="${session.user.user_code}"></a></span>
    <h1>图书借阅系统</h1>
    <form action="selectbook" method="get">
        图书分类：<input type="text" name="book_type" placeholder="请输入图书分类" />
        图书名称：<input type="text" name="book_name" placeholder="请输入图书名称" />
        是否借阅：
        <select name="is_borrow">
            <option value="">请选择</option>
            <option value="1">已借出</option>
            <option value="0">未借出</option>
        </select>
        <input type="submit" value="查询" />
    </form>

    <table border="1" cellpadding="5" cellspacing="0">
        <thead>
        <tr>
            <th>图书编号</th>
            <th>图书分类</th>
            <th>图书名称</th>
            <th>作者</th>
            <th>出版社</th>
            <th>借阅状态</th>
        </tr>
        </thead>
        <tbody>

        <!-- 遍历书籍列表并显示每一本书的信息 -->
        <tr th:each="book : ${session.books}">
            <td th:text="${book.book_id}"></td>
            <td th:text="${book.getBook_type()}"></td>
            <td th:text="${book.book_name}"></td>
            <td th:text="${book.getBook_author()}"></td>
            <td th:text="${book.getPublish_press()}"></td>
            <td th:text="${book.getIs_borrow()==1 ?'已借出':'待借阅'}"></td>
        </tr>
        </tbody>
    </table>

</body>
</html>